package com.mt.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;

/**
 * @author Wang
 * @Description acl类型枚举
 * @date 2020/11/13-11:39
 */
public enum AclType {

    CATALOG(0,"CATALOG"),
    MENU(1,"MENU"),
    BUTTON(2,"BUTTON");

    @EnumValue
    private Integer type;
    @JsonValue
    private String typeName;

    AclType() {}

    AclType(Integer type, String typeName) {
        this.type = type;
        this.typeName=typeName;
    }

    public  static Integer getAclType(String typeName){

        for (AclType aclType:AclType.values()){
            if (aclType.getTypeName().equals(typeName)){
                return aclType.getType();
            }
        }
        return null;
    }
    public  static String getAclType(Integer type){
        for (AclType aclType:AclType.values()){
            if (aclType.getTypeName().equals(type)){
                return aclType.getTypeName();
            }
        }
        return null;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public String getTypeName() {
        return typeName;
    }

    public void setTypeName(String typeName) {
        this.typeName = typeName;
    }
}
